Cover | TOC | Chap | Prev Chap | Prev Fig | Next Fig | Next Chap |
|
Figure 8.8
A group of three orbiting planets, each one using its own TimeSensor node to control its orbit time. |
|
Click on the image to view the VRML scene. |
#VRML V2.0 utf8 # The VRML 2.0 Sourcebook # Copyright (c) 1997 # Andrea L. Ames, David R. Nadeau, and John L. Moreland Group { children [ # Stationary Sun Shape { appearance DEF White Appearance { material Material { } } geometry Sphere { } }, # Several orbiting planets DEF Planet1 Transform { translation 2.0 0.0 0.0 center -2.0 0.0 0.0 children Shape { appearance USE White geometry Sphere { radius 0.2 } } }, DEF Planet2 Transform { translation 3.0 0.0 0.0 center -3.0 0.0 0.0 children Shape { appearance USE White geometry Sphere { radius 0.3 } } }, DEF Planet3 Transform { translation 4.0 0.0 0.0 center -4.0 0.0 0.0 children Shape { appearance USE White geometry Sphere { radius 0.5 } } }, # Animation clocks, one per planet DEF Clock1 TimeSensor { cycleInterval 2.0 loop TRUE }, DEF Clock2 TimeSensor { cycleInterval 3.5 loop TRUE }, DEF Clock3 TimeSensor { cycleInterval 5.0 loop TRUE }, # Animation paths, one per planet DEF PlanetPath1 OrientationInterpolator { key [ 0.0, 0.50, 1.0 ] keyValue [ 0.0 0.0 1.0 0.0, 0.0 0.0 1.0 3.14, 0.0 0.0 1.0 6.28 ] }, DEF PlanetPath2 OrientationInterpolator { key [ 0.0, 0.50, 1.0 ] keyValue [ 0.0 0.0 1.0 0.0, 0.0 0.0 1.0 3.14, 0.0 0.0 1.0 6.28 ] }, DEF PlanetPath3 OrientationInterpolator { key [ 0.0, 0.50, 1.0 ] keyValue [ 0.0 0.0 1.0 0.0, 0.0 0.0 1.0 3.14, 0.0 0.0 1.0 6.28 ] } ] } ROUTE Clock1.fraction_changed TO PlanetPath1.set_fraction ROUTE Clock2.fraction_changed TO PlanetPath2.set_fraction ROUTE Clock3.fraction_changed TO PlanetPath3.set_fraction ROUTE PlanetPath1.value_changed TO Planet1.set_rotation ROUTE PlanetPath2.value_changed TO Planet2.set_rotation ROUTE PlanetPath3.value_changed TO Planet3.set_rotation